package com.gss.armory.form;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

import com.gss.armory.domain.DocumentMetadataValueDTO;
import com.gss.common.util.ApplicationConstants;
import com.gss.common.util.ApplicationMaps;

public class DocDetailsForm implements Serializable{
	
	private long docId;
	@Pattern(regexp=ApplicationConstants.REGEX_FOR_DOC_NAME,message="Invalid Document Name")
	@Length(max=100)
	private String docName;
	@Pattern(regexp=ApplicationConstants.REGEX_FOR_DESC,message="Invalid Document Desc")
	private String docDesc;
	private String docCategory;
	private int docCategoryId;
	private String docSubCategory;
	private int docSubCategoryId;
	private String docType;
	private int docTypeId;
	@NotBlank
	private String docOwnerId;
	@NotBlank
	private String docOwnerName;
	private int docLocId;
	private String docLoc;
	private int docDepttId;
	private String docDeptt;
	private boolean renewable;
	private int originalDocTypeId;
//	private List<DocMetaDataAttrForm> metaDataAttrList = new ArrayList<DocMetaDataAttrForm>();
//	private List<DocumentMetadataValueDTO> metadataValueList = new ArrayList<DocumentMetadataValueDTO>();
//	// doc validity details
	@DateTimeFormat(pattern="dd-MM-yyyy")
	private Date docValidityStartDate;
	@DateTimeFormat(pattern="dd-MM-yyyy")
	private Date docValidityEndDate;
	private int firstEscalationPeriod;
	private int secondEscalationPeriod;
	private int thirdEscalationPeriod;
	private String docCode;
	private transient MultipartFile docContent;
	private String[] linkedDocId;
	private String[] oldLinkedDocument;
	private String[] authSignatory;
	
	private String documentStatus;
	
	@Pattern(regexp=ApplicationConstants.REGEX_FOR_DESC)
	private String docIssuingAuthority;
	@Pattern(regexp=ApplicationConstants.REGEX_FOR_DESC)
	private String docEnteredWith;
	
	private Integer docCompanyId;
	private String docCompanyName;
	
	private int errorCount;
	private String custodianName;

	public long getDocId() {
		return docId;
	}
	public String getDocName() {
		return docName;
	}
	public String getDocDesc() {
		return docDesc;
	}
	public String getDocCategory() {
		return docCategory;
	}
	public int getDocCategoryId() {
		return docCategoryId;
	}
	public String getDocSubCategory() {
		return docSubCategory;
	}
	public int getDocSubCategoryId() {
		return docSubCategoryId;
	}
	public String getDocType() {
		return docType;
	}
	public int getDocTypeId() {
		return docTypeId;
	}
	public String getDocOwnerId() {
		return docOwnerId;
	}
	public String getDocOwnerName() {
		return docOwnerName;
	}
	public int getDocLocId() {
		return docLocId;
	}
	public String getDocLoc() {
		return docLoc;
	}
	public int getDocDepttId() {
		return docDepttId;
	}
	public String getDocDeptt() {
		return docDeptt;
	}
	public boolean isRenewable() {
		return renewable;
	}
//	public List<DocMetaDataAttrForm> getMetaDataAttrList() {
//		return metaDataAttrList;
//	}
	public void setDocId(long docId) {
		this.docId = docId;
	}
	public void setDocName(String docName) {
		this.docName = docName;
	}
	public void setDocDesc(String docDesc) {
		this.docDesc = docDesc;
	}
	public void setDocCategory(String docCategory) {
		this.docCategory = docCategory;
	}
	public void setDocCategoryId(int docCategoryId) {
		this.docCategoryId = docCategoryId;
	}
	public void setDocSubCategory(String docSubCategory) {
		this.docSubCategory = docSubCategory;
	}
	public void setDocSubCategoryId(int docSubCategoryId) {
		this.docSubCategoryId = docSubCategoryId;
	}
	public void setDocType(String docType) {
		this.docType = docType;
	}
	public void setDocTypeId(int docTypeId) {
		this.docTypeId = docTypeId;
	}
	public void setDocOwnerId(String docOwnerId) {
		this.docOwnerId = docOwnerId;
	}
	public void setDocOwnerName(String docOwnerName) {
		this.docOwnerName = docOwnerName;
	}
	public void setDocLocId(int docLocId) {
		this.docLocId = docLocId;
	}
	public void setDocLoc(String docLoc) {
		this.docLoc = docLoc;
	}
	public void setDocDepttId(int docDepttId) {
		this.docDepttId = docDepttId;
	}
	public void setDocDeptt(String docDeptt) {
		this.docDeptt = docDeptt;
	}
	public void setRenewable(boolean renewable) {
		this.renewable = renewable;
	}
//	public void setMetaDataAttrList(List<DocMetaDataAttrForm> metaDataAttrList) {
//		this.metaDataAttrList = metaDataAttrList;
//	}

	// following fields for doc validity details
	public Date getDocValidityStartDate() {
		return docValidityStartDate;
	}
	public Date getDocValidityEndDate() {
		return docValidityEndDate;
	}
	public int getFirstEscalationPeriod() {
		return firstEscalationPeriod;
	}
	public int getSecondEscalationPeriod() {
		return secondEscalationPeriod;
	}
	public int getThirdEscalationPeriod() {
		return thirdEscalationPeriod;
	}
	public void setDocValidityStartDate(Date docValidityStartDate) {
		this.docValidityStartDate = docValidityStartDate;
	}
	public void setDocValidityEndDate(Date docValidityEndDate) {
		this.docValidityEndDate = docValidityEndDate;
	}
	public void setFirstEscalationPeriod(int firstEscalationPeriod) {
		this.firstEscalationPeriod = firstEscalationPeriod;
	}
	public void setSecondEscalationPeriod(int secondEscalationPeriod) {
		this.secondEscalationPeriod = secondEscalationPeriod;
	}
	public void setThirdEscalationPeriod(int thirdEscalationPerioDocDetailsFormd) {
		this.thirdEscalationPeriod = thirdEscalationPerioDocDetailsFormd;
	}
	public MultipartFile getDocContent() {
		return docContent;
	}
	public void setDocContent(MultipartFile docContent) {
		this.docContent = docContent;
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("DocDetailsForm [docCategory=");
		builder.append(docCategory);
		builder.append(", docCategoryId=");
		builder.append(docCategoryId);
		builder.append(", docDeptt=");
		builder.append(docDeptt);
		builder.append(", docDepttId=");
		builder.append(docDepttId);
		builder.append(", docDesc=");
		builder.append(docDesc);
		builder.append(", docId=");
		builder.append(docId);
		builder.append(", docLoc=");
		builder.append(docLoc);
		builder.append(", docLocId=");
		builder.append(docLocId);
		builder.append(", docName=");
		builder.append(docName);
		builder.append(", docOwnerId=");
		builder.append(docOwnerId);
		builder.append(", docOwnerName=");
		builder.append(docOwnerName);
		builder.append(", docSubCategory=");
		builder.append(docSubCategory);
		builder.append(", docSubCategoryId=");
		builder.append(docSubCategoryId);
		builder.append(", docType=");
		builder.append(docType);
		builder.append(", docTypeId=");
		builder.append(docTypeId);
		builder.append(", docValidityEndDate=");
		builder.append(docValidityEndDate);
		builder.append(", docValidityStartDate=");
		builder.append(docValidityStartDate);
		builder.append(", firstEscalationPeriod=");
		builder.append(firstEscalationPeriod);
		builder.append(", renewable=");
		builder.append(renewable);
		builder.append(", secondEscalationPeriod=");
		builder.append(secondEscalationPeriod);
		builder.append(", thirdEscalationPeriod=");
		builder.append(thirdEscalationPeriod);
		builder.append("]");
		return builder.toString();
	}
	public String getDocCode() {
		return docCode;
	}
	public void setDocCode(String docCode) {
		this.docCode = docCode;
	}
	public String[] getLinkedDocId() {
		return linkedDocId;
	}
	public void setLinkedDocId(String[] linkedDocId) {
		this.linkedDocId = linkedDocId;
	}
	public String[] getOldLinkedDocument() {
		return oldLinkedDocument;
	}
	public void setOldLinkedDocument(String[] oldLinkedDocument) {
		this.oldLinkedDocument = oldLinkedDocument;
	}
	public String[] getAuthSignatory() {
		return authSignatory;
	}
	public void setAuthSignatory(String[] authSignatory) {
		this.authSignatory = authSignatory;
	}
	public int getErrorCount() {
		return errorCount;
	}
	public void setErrorCount(int errorCount) {
		this.errorCount = errorCount;
	}
//	public List<DocumentMetadataValueDTO> getMetadataValueList() {
//		return metadataValueList;
//	}
//	public void setMetadataValueList(List<DocumentMetadataValueDTO> metadataValueList) {
//		this.metadataValueList = metadataValueList;
//	}
	public int getOriginalDocTypeId() {
		return originalDocTypeId;
	}
	public void setOriginalDocTypeId(int originalDocTypeId) {
		this.originalDocTypeId = originalDocTypeId;
	}
	public String getDocIssuingAuthority() {
		return docIssuingAuthority;
	}
	public String getDocEnteredWith() {
		return docEnteredWith;
	}
	public void setDocIssuingAuthority(String docIssuingAuthority) {
		this.docIssuingAuthority = docIssuingAuthority;
	}
	public void setDocEnteredWith(String docEnteredWith) {
		this.docEnteredWith = docEnteredWith;
	}
	public String getDocumentStatus() {
		return documentStatus;
	}
	public void setDocumentStatus(String documentStatus) {
		this.documentStatus = documentStatus;
	}

	public Integer getDocCompanyId() {
		return docCompanyId;
	}
	public void setDocCompanyId(Integer docCompanyId) {
		this.docCompanyId = docCompanyId;
		setDocCompanyName(ApplicationMaps.COMPANYID_COMPANY_MAP.get(docCompanyId).getCdName());
	}
	public String getDocCompanyName() {
		return docCompanyName;
	}
	public void setDocCompanyName(String docCompanyName) {
		this.docCompanyName = docCompanyName;
	}
	public String getCustodianName() {
		return custodianName;
	}
	public void setCustodianName(String custodianName) {
		this.custodianName = custodianName;
	}

	
}
